home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / VOL_400 / 466_01 / SRC / FMTFILE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-20  |  1.4 KB  |  88 lines

  1. #include <afx.h>
  2. #include <afxtempl.h>
  3. #include "parse.h"
  4. #include "input.h"
  5. #include "fmt.h"
  6. #include "fmtfile.h"
  7. #include "errmsg.h"
  8.  
  9.  
  10. /******************************************************/
  11. // Tag list
  12. /******************************************************/
  13.  
  14. TAGSPEC gtagsFileSection[] =
  15. {
  16.     CFmtListFile::tagPre,    "pre",
  17.     CFmtListFile::tagPost,   "post",
  18.     CFmtListFile::tagOutput, "output",
  19.     -1,        NULL,
  20. };
  21.  
  22.  
  23.  
  24.  
  25. /******************************************************/
  26. // List class
  27. /******************************************************/
  28.  
  29.  
  30. TAGSPEC *CFmtListFile::FmtTagList(void)
  31. {
  32.     return gtagsFileSection;
  33. }
  34.     
  35.  
  36. int CFmtListFile::ParseEntry(CFmtInput &in)
  37. {
  38.     int nRet;
  39.  
  40.     switch(m_nTag)
  41.     {
  42.     // Parent
  43.  
  44.     case tagOutput:
  45.         
  46.         // Expect: .output = output_type
  47.  
  48.         if(in.m_nTokens != 1)
  49.             return fmterrFileOutputNum;
  50.  
  51.         if(!CheckOutputType(in, 0))
  52.             return 0;
  53.  
  54.         nRet = CheckAddTag();
  55.         if(nRet)
  56.             return nRet;
  57.  
  58.         m_pNew = new CFmtFile;
  59.  
  60.         m_pNew->SetSource(in.m_nFile, in.m_lCurLine);
  61.  
  62.         m_nState.Tag = TRUE;
  63.  
  64.         break;
  65.  
  66.     // RTF file header and footer
  67.  
  68.     case tagPre:
  69.     case tagPost:
  70.  
  71.         // expect: .pre= format string
  72.  
  73.         nRet = SetFmtString(in, 0);
  74.  
  75.         if(nRet)
  76.             return nRet;
  77.         break;
  78.  
  79.     default:
  80.         return fmterrBadFmtEntry;
  81.     }
  82.  
  83.     return 0;
  84. }
  85.  
  86.  
  87.  
  88.